package com.example.mybatisplusdemo.common.utls;

import lombok.Data;

@Data
public class Res<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Res<T> success(String msg,T data){
        Res<T> res = new Res<T>();
        res.code = 200;
        res.msg = msg;
        res.data = data;
        return res;
    }

    public static <T> Res<T> error(String msg){
        Res<T> res = new Res<T>();
        res.code = 400;
        res.msg = msg;
        res.data = null;
        return res;
    }
}